package uk.ac.ncl.carrent.car;

import uk.ac.ncl.carrent.RegistrationNumber;

/**
 * 
 * @author Shiwe He
 *
 */
final class SmallCar extends AbstractCar {
	
	private static final int consume = 20;
	
	SmallCar(RegistrationNumber regNumber){
		super(regNumber, "small");
		super.setCapacity(49);
	}
	
	/**
	 * see the drive method of Car
	 */
	@Override
	public int drive(int distance){
		int consumed = 0;
		if(! (distance >= 0)){
			throw new IllegalArgumentException("Invalid distance!");
		}
		consumed = distance/consume;
		super.setCurrentFuel(super.getCurrentFuel() - consumed);
		return consumed;
	}
	
}